package com.szr.leex.po;

import java.time.LocalDateTime;

import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;

/**
 * BaseEntityEventListener
 * Created by WangChen on 2018/9/12 17:06.
 */
public class BaseEntityEventListener {

    @PrePersist
    public void prePersist(BaseEntity entity){
        entity.setCreateTime(LocalDateTime.now());
    }

    @PreUpdate
    public void preUpdate(BaseEntity entity){
        entity.setUpdateTime(LocalDateTime.now());
    }
}
